package com.lrs.java.j2se_self.gui;
import java.awt.*;
import java.awt.event.*;
public class TestWindowListener {
	public static void main(String[] args){
		new MyWindowFrame("WindowListener"); 
	}
}
class MyWindowFrame extends Frame {
	MyWindowFrame (String s) {
		setLayout(null);
		setBounds(100,200,300,400);
		this.setBackground(Color.green);
		this.setVisible(true);
		this.addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent e){
			//setVisible(false);
			System.exit(0);}
			});
	}
	/*
	private class MyWindowMonitor extends WindowAdapter {
		public void windowClosing(WindowEvent e){
			setVisible(false);
			System.exit(0);
		}
	}
	*/
}